//
//  RecommedListViewController.m
//  RACDemo
//
//  Created by XFB on 2018/8/8.
//  Copyright © 2018年 ZhouCheng. All rights reserved.
//

#import "RecommedListViewController.h"
#import "ReactiveObjC.h"
#import "ListViewModel.h"

@interface RecommedListViewController ()

@property (nonatomic, strong) ListViewModel *listVM;

@end

@implementation RecommedListViewController

- (ListViewModel *)listVM
{
    if (_listVM == nil) {
        _listVM = [[ListViewModel alloc] init];
    }
    return _listVM;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    @weakify(self);
    
    [[self.listVM.loadListDataCommand execute:nil] subscribeNext:^(id responseObject) {
        @strongify(self);
        // 刷新表格
        [self.tableView reloadData];
    } error:^(NSError * _Nullable error) {
        NSLog(@"%@",error);
    }];

    // 绑定视图模型,对控件的设置
    [self.listVM bindViewModel:self.tableView];
}

@end
